//
//  MsgConversationModel.m
//  fitnessmanage
//
//  Created by wujian on 2017/12/22.
//  Copyright © 2017年 zongquankeji. All rights reserved.
//

#import "MsgConversationModel.h"

#define AccountFilePath [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject] stringByAppendingPathComponent:[NSString stringWithFormat:@"%@MsgConversation.data",[[NSUserDefaults standardUserDefaults]objectForKey:@"UserID"]]]

@implementation MsgConversationModel

MJCodingImplementation

+ (void)saveMsgConversation:(MsgConversationModel *)conv
{
    // 归档
    [NSKeyedArchiver archiveRootObject:conv toFile:AccountFilePath];
}

+(MsgConversationModel *)msgConversation
{
    // 读取帐号
    MsgConversationModel *msgConversation = [NSKeyedUnarchiver unarchiveObjectWithFile:AccountFilePath];
    
    if (!msgConversation) {
        
        msgConversation = [[MsgConversationModel alloc] init];
        
        msgConversation.convDict = [[NSMutableDictionary alloc] init];
        
    }
    return msgConversation;
}

@end
